home *** CD-ROM | disk | FTP | other *** search
/ Freelog 46 / Freelog046.iso / Alu / Celestia / Win32LoresTex / celestia-lores-win32-1.3.0.exe / {app} / shaders / diffuse_arb.vp < prev    next >
Text File  |  2003-02-17  |  981b  |  37 lines

  1. !!ARBvp1.0
  2.  
  3. # Compute the diffuse light from a single source
  4.  
  5. ATTRIB iPos          = vertex.position;
  6. ATTRIB iNormal       = vertex.normal;
  7. ATTRIB iTex0         = vertex.texcoord[0];
  8. PARAM  mvp[4]        = { state.matrix.mvp };
  9. PARAM  lightDir      = program.env[0];
  10. PARAM  diffuse       = program.env[2];
  11. PARAM  ambient       = state.lightmodel.ambient;
  12. PARAM  zeroVec       = { 0, 0, 0, 0 };
  13. OUTPUT oPos          = result.position;
  14. OUTPUT oColor        = result.color;
  15. OUTPUT oTex0         = result.texcoord[0];
  16.  
  17. TEMP   diffuseFactor;
  18.  
  19. # Transform the vertex by the modelview matrix
  20. DP4   oPos.x, mvp[0], iPos;
  21. DP4   oPos.y, mvp[1], iPos;
  22. DP4   oPos.z, mvp[2], iPos;
  23. DP4   oPos.w, mvp[3], iPos;
  24.  
  25. # Compute the diffuse light component
  26. DP3   diffuseFactor, iNormal, lightDir;
  27. # Clamp the diffuse component to zero
  28. MAX   diffuseFactor, diffuseFactor, zeroVec;
  29.  
  30. # Output the texture
  31. MOV   oTex0, iTex0;
  32. # Output the primary color
  33. MAD   oColor, diffuse, diffuseFactor, ambient;
  34.  
  35. END
  36.  
  37.